using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FiltronASP.Models.DAO.Filtron;
using FiltronASP.Models.DAO.Interfaces.Filtron;
using FiltronASP.Models;
using FiltronASP.Helpers.Translations;
using FiltronASP.Models.DAO;
using FiltronASP.Models.DAO.Interfaces;
using System.Net.Mail;


namespace FiltronASP.Ajax
{
    public partial class sendMail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            MailMessage msg = new MailMessage();
            msg.From = new MailAddress("formularz@b2net.pl");
            msg.To.Add(new MailAddress("wixeurope@affiniagroup.com"));
            string cntSubject = Convert.ToString(Request["cntSubject"]);
            string cntName = Convert.ToString(Request["cntName"]);
            string cntEmail = Convert.ToString(Request["cntEmail"]);
            string cntAddress = Convert.ToString(Request["cntAddress"]);
            string cntCity = Convert.ToString(Request["cntCity"]);
            string cntZipCode = Convert.ToString(Request["contactZipCodeFirst"] + Request["contactZipCodeSecond"]);
            string cntCountry = Convert.ToString(Request["cntCountry"]);
            string cntPhone = Convert.ToString(Request["cntPhone"]);
            string cntQuestion = Convert.ToString(Request["cntQuestion"]);

            string msgBody = "Imię: " + cntName + "\r\n" + "Email: " + cntEmail + "\r\n" + "Adres: " + cntAddress + "\r\n" + "Miasto: " + cntCity + "\r\n" + "Kod pocztowy: " + cntZipCode + "\r\n" + "Kraj: " + cntCountry + "\r\n" + "Telefon: " + cntPhone + "\r\n" + "Pytanie: " + cntQuestion;

            msg.Subject = cntSubject;
            msg.Body = msgBody;

            try
            {
                SmtpClient SMTP = new SmtpClient();
                SMTP.EnableSsl = true;
                SMTP.Send(msg);
            }
            catch (Exception ex)
            {
            }
        }

    }
}
